#pragma once
#include<iostream>
#include<assert.h>
using namespace std;

namespace iterator_adapter
{
    template<class Iterator, class Ref, class Ptr>
    struct Reverse_iterator
    {
        typedef Reverse_iterator<Iterator, Ref, Ptr> Rev;

        Rev& operator++()
        {
            --_it;
            return *this;
        }
        Rev operator++(int)
        {
            iterator tmp = _it;
            --_it;
            return tmp;
        }

        Rev& operator--()
        {
            ++_it;
            return *this;
        }
        Rev operator--(int)
        {
            iterator tmp = _it;
            ++_it;
            return tmp;
        }

        bool operator!=(const Rev& s)
        {
            return _it != s._it;
        }
        bool operator==(const Rev& s)
        {
            return _it == s._it;
        }

        Ref operator*()
        {
            iterator tmp = _it;
            --tmp;
            return *tmp;
        }

        Reverse_iterator(Iterator it)
            :_it(it)
        {

        }

        Iterator _it;
    };
}